/*
 * @lc app=leetcode.cn id=1876 lang=typescript
 *
 * [1876] 长度为三且各字符不同的子字符串
 */

// @lc code=start
function countGoodSubstrings(s: string): number {
    let count = 0;
    for (let i = 2; i < s.length; i++) {
        const before = s[i - 2];
        const prev = s[i - 1];
        const element = s[i];
        if (element !== before && element != prev && before !== prev) count++;
    }
    return count;
}
// @lc code=end
